package com.java1234.service.impl;

import javax.annotation.Resource;

import com.java1234.dao.MemberShipDao;
import org.springframework.stereotype.Service;

import com.java1234.dao.UserDao;
import com.java1234.entity.User;
import com.java1234.service.UserService;

import java.util.List;
import java.util.Map;


@SuppressWarnings("ALL")
@Service("userService")
public class UserServiceImpl implements UserService{

	@Resource
	private MemberShipDao memberShipDao;
	@Resource
	private UserDao userDao;
	
	public User findById(String id) {
		return userDao.findById(id);
	}

	public List<User> find(Map<String, Object> map) {
		return userDao.find(map);
	}

	public Long getTotal(Map<String, Object> map) {
		return userDao.getTotal(map);
	}

	public void delete(String id) {
		memberShipDao.removeRelationByUser(id);
		userDao.delete(id);
	}

	@Override
	public Integer add(User user) {
	    return	userDao.add(user);
	}

	@Override
	public Integer update(User user) {
		return userDao.update(user);
	}

}
